#include<iostream>
const double P = 3.14;
using namespace std;
class container {
protected:
    double radius;
public:
    container(double radius_) : radius(radius_) {}
    virtual double surface_area() = 0;
    virtual double volume() = 0;
    virtual void display() {
        cout << "面积: " << surface_area() << endl;
        cout << "体积: " << volume() << endl;
    }
};
class cube : public container {
private:
    double R;
public:
    cube(double R_) : container(R), R(R_) {}
    double surface_area()  {
        return 6 * R * R;
    }
    double volume()  {
        return R * R * R;
    }
    void display()  {
        cout << "正方体 ";
        container::display();
    }
};
class sphere : public container {
private:
    double r;
public:
    sphere(double r_) : container(r), r(r_) {}
    double surface_area()  {
        return 4*P * r * r;
    }
    double volume()  {
        return 4.0 / 3.0 * P * r * r * r;
    }
    void display()  {
        cout << "球 ";
        container::display();
    }
};
class cylinder : public container {
private:
    double height;
public:
    cylinder(double radius, double height) : container(radius), height(height) {}
    double surface_area()  {
        return 2 * P * radius * (radius + height);
    }
    double volume()  {
        return P * radius * radius * height;
    }
    void display()  {
        cout << "圆柱体 ";
        container::display();
    }
};
int main() {
    cube cu(6.0);
    sphere s(5.0);
    cylinder cy(5.0, 6.0);
    cu.display();
    s.display();
    cy.display();
    return 0;
}
